﻿/*
 * Create By:Jeff Yuan
 * Create Time : 2009-03-16 11:30
 * 
 */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using Jumpton.SFA.Server.Entity;
using Jumpton.Persistent;
using Jumpton.SFA.Server.BusinessRule;
using Jumpton.Data;

namespace Jumpton.SFA.Server.BusinessRule.System
{
    public class EventLogConfigManager 
    {
       

        #region 保存
       
        public void Save(EventLogConfig  eventlogconfig)
        {
        
           
            if (eventlogconfig != null)
            {
                try
                {
                    //if (eventlogtype.State == DataRowState.Added)
                    //    eventlogtype.LogTypeKey = Common.KeyFactoryManager.GetCurrentValue("LogTypeKey", 0);


                    EventLogConfig objx = ObjectRow.Load(typeof(EventLogConfig), string.Format("LogTypeKey='{0}'", eventlogconfig.LogTypeKey)) as EventLogConfig;
                    if (objx != null)
                    {
                        throw new Exception("存在配置事件类型");
                    }
                    eventlogconfig.Save();


                }
                catch (Exception error)
                {
                    throw new Exception(error.Message);
                }
            }

        }
        #endregion

      

        #region 获得唯一性代码数据
       
        public EventLogTypes LoadByCode(string Code)
        {
            return (EventLogTypes)ObjectRow.Load(typeof(EventLogTypes), "LogTypeKey='" + Code.ToString() + "'");
        }
        #endregion

        #region 获得一组数据
       
        public ObjectTable LoadWithCondition(string Condition)
        {
            return new ObjectTable(typeof(EventLogTypes), Condition.ToString());
        }
        #endregion



    }
}
